package com.mj.listen2._01_排序.cmp;

/**
 * 冒泡排序最基本写法
 */
public class _01_BubbleSort1<T extends Comparable<T>> extends Sort<T> {
    @Override
    protected void sort() {
        for (int end = array.length - 1; end > 0; end--) {
            for (int i = 1; i <= end; i++) {
                if (cmp(array[i - 1], array[i]) > 0) {
                    swap(i, i - 1);
                }
            }
        }
    }
}
